<!--
 * @Author: root 2394041502@qq。com
 * @Date: 2022-11-16 15:06:03
 * @LastEditors: root 2394041502@qq。com
 * @LastEditTime: 2022-11-16 15:21:27
 * @FilePath: \vue\src\components\HelloWorld.vue
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
<template>
  <div class="hello">
    <button @click="sendClick">点击发送axios请求</button>
    <p style="color:blueviolet">{{text}}</p>
  </div>
</template>

<script>
  import axios from 'axios'

export default {
  name: 'HelloWorld',
  data() {
    return {
      text: '发送请求后显示的内容'
    }
  },
  methods: {
    sendClick(){
      alert("正在发送axios请求")
      axios.get('http://127.0.0.1:9090/findUser').then(
          response =>{
            console.log('请求成功',response.data);
            this.text=response.data;
            alert("请求成功")
          },
          error=>{
            console.log('请求失败',error.message);
          }
        )
    }
  }

}
</script>
<style scoped>
h3 {
  margin: 40px 0 0;
}
ul {
  list-style-type: none;
  padding: 0;
}
li {
  display: inline-block;
  margin: 0 10px;
}
a {
  color: #42b983;
}
</style>
